package com.apetrenko.avaya.callstore.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;

public class RecordsContentProvider implements ContentProvider,
		AsyncCallback<Record[]> {

	private IUpdatableTable iTarget;

	public void requestUpdate() {
		RecordsServiceAsync vService = GWT.create(RecordsService.class);
		vService.getRecords(1l, this);		
	}

	public void setTarget(IUpdatableTable aTable) {
		iTarget = aTable;
	}

	public void onFailure(Throwable aCaught) {
		iTarget.updateFail(aCaught);
	}

	public void onSuccess(Record[] aResult) {
		iTarget.doUpdate(aResult);
	}

}
